<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>

<form th:action="@{/goods}" th:object="${goods}" method="post">
    <div th:if="${goods.id == null}">
        <h1>新增分类</h1>
    </div>
    <div th:if="${goods.id != null}">
        <h1>修改分类</h1>
        <input type="hidden" name="_method" value="PUT">
        <input type="hidden" th:field="*{id}">
    </div>

    <p>分类id：<input type="text" th:field="*{id}"></p>
    <p>分类名称：<input th:field="*{name}" type="text"></p>
    <p>上级分类id：
        <select th:field="*{pid}">
            <option th:each="job:${pid}" th:value="${job.key}">
                <span th:text="${job.value}"></span>
            </option>
        </select>
    </p>
    <p>分类说明：<input th:field="*{remark}" type="text"></p>
    <button>保存</button>
</form>
</body>
</html>